ResText XFCN allows to get text from any resource.
SYNTAX
ResText(<res type>,<res ID or name>[,<#X>][,<fileName>]
[,"hex"][,<stripCtrl>][,"DontResolveAlias"])
PARAMETERS
<res type> is a four chars string, giving the resource type.
<res ID or name> can be the ID or the name of the resource.
<#X> allows to give the item number of a STR# resource (ex : "#1"). Default returns all items, this param is ignored for other resource types.
<fileName> is optional, and the full pathname of the file to get the resource from. It can be a single name or whole pathname. If just a single name is supplied, the file is assumed to be in the same folder than the current stack. If not provided, the current stack is used.
If "all" is passed here, all resource file hierarchy will be explored starting from current stack until System file.
"hex" allows to get the resut as hexadecimal string rather that ASCII.
<stripCtrl> is a boolean allowing to filter control chars from the got text, and replace them with "[<ASCII value>]". Default is TRUE, this param is ignored with "hex" output.
"dontResolveAlias" allows to deal with an alias file itself (System 7.0 only) rather than with the file pointed by it.
Using "!", "?" or "=" as first parameter will return an online help (resp. copyright, syntax and output).
USING
The XFCN returns the text read from the resource. Two special cases must be considered :
STR : result will contain two lines being respectively the text and the datas found in the resource. Each of them can be empty.
STR# : result will contain one line per entry found in the resource.
With an ASCII output string, any control chars will be replaced by "[<ASCII value>]". Don't forget to replace them if needed, using RestoreSpecialChars XFCN.
ERRORS
If an error occurs, ResText can return :
"Error : Not a file"
"Error : Alias file not supported"
"Error : Volume not found"
"Error : Bad Name"
"Error : File not found"
"Error : Folder not found"
"Error : File is busy"
"Error : I/O Error"
"Error : No resource fork"
"Error : AppleShare insufficient privileges"
"Error : Missing or empty parameter(s)"
"Error : Bad resource type"
"Error : Resource not found"
"Error : Out of memory"
"Error : Incorrect STR# item number"
"Error : Index is out of range"
HISTORY
2.3 : 02/07/94
• Fixed memory bug
• Replacement of control chars by <ASCII value> 15 times faster!
Free for non-commercial use. Use in commercial software subjected to prior acknowledgement and licensing from the author, reachable at the following network addresses: